# -*- coding: utf-8 -*-
require "rubygems"
require "spreadsheet"

b = Spreadsheet.open("110131決定あうんカラー色データー-with-CMYK.xls")
sheet = b.worksheet(0)

puts "var ct        = new Array();"
puts "var mancel_ct = new Array();"
puts "var rgb10_ct  = new Array();"
puts "var color_num = new Array();"
puts "var cmyk_ct   = new Array();"
puts "var num2bg    = new Array();"
print "\n\n"

sheet.collect.each do |l|
#  l.chop!
  color_num = l[0].to_s
  ct_i      = l[2].to_s
  mancel    = l[4].to_s.gsub(/[\"\s]/,'') + l[5].to_s.gsub(/[\"\s]/,'') + "/"+ l[6].to_s.gsub(/[\"\s]/,'')
  c         = l[7].to_s
  rgb10     = l[8].to_s + "-" + l[9].to_s + "-" + l[10].to_s
  cmyk      = l[11].to_s
  
  ct_i = ct_i.gsub(/[\"\s]/,'')
  
  c     = c.gsub(/[\"\[\]]/,'')
  rgb10 = rgb10.gsub(/[\s\"]/,'')

  puts 'ct["' +ct_i +'"]="' + c + '";'
  puts 'mancel_ct["' +ct_i +'"]="' + mancel + '";'
  puts 'rgb10_ct["'  +ct_i +'"]="' + rgb10 + '";'
  puts 'color_num["' +ct_i +'"]="' + color_num + '";';
  puts 'cmyk_ct["'   +ct_i +'"]="' + cmyk + '";';
  puts 'num2bg["'   + color_num +'"]="rgb(' +  l[8].to_s + ","+ l[9].to_s + ","+ l[10].to_s  + ')";';
  puts ""
end
